{{ if $.Values.egress.podDisruptionBudget.enabled }}
{{ if .Capabilities.APIVersions.Has "policy/v1" }}
apiVersion: policy/v1
{{ else if .Capabilities.APIVersions.Has "policy/v1beta1" }}
apiVersion: policy/v1beta1
{{ else }}
{{ fail "pod disruption budgets are not supported by this version of kubernetes" }}
{{ end }}
kind: PodDisruptionBudget
metadata:
  name: {{ include "kuma.name" . }}-egress
  namespace: {{ .Release.Namespace }}
  labels: {{ include "kuma.egressLabels" . | nindent 4 }}
spec:
  maxUnavailable: {{ .Values.egress.podDisruptionBudget.maxUnavailable }}
  selector:
    matchLabels:
      {{- include "kuma.selectorLabels" . | nindent 6 }}
      app: {{ include "kuma.name" . }}-egress
{{ end }}
